<template>
	<view class="container">
		<tui-list-view class="tui-list-view">
			<!-- <tui-list-cell @click="detail" class="tui-list">
				<tui-icon name="wealth-fill" color="#ff7900"></tui-icon>
				<text class="tui-list-cell-name">我的钱包</text>
			</tui-list-cell> -->
			<tui-list-cell @click="gerenXinxi" class="tui-list">
				<tui-icon name="people-fill" color="#fcd6d2"></tui-icon>
				<view class="tui-list-cell-name">个人信息--</view>
			</tui-list-cell>
			<tui-list-cell @click="$tools.uniApp.navigateTo('edit')" class="tui-list">
				<tui-icon name="people-fill" color="#fcd6d2"></tui-icon>
				<view class="tui-list-cell-name">编辑信息</view>
			</tui-list-cell>
			<!-- -->
			<tui-list-cell @click="tuiguang" class="tui-list">
				<tui-icon name="link" color="#fcd6d2"></tui-icon>
				<view class="tui-list-cell-name">分享给好友</view>
				<tui-tag size="small" type="light-orange" shape="circle" class="tui-right">新用户注册获得3个积分</tui-tag>
			</tui-list-cell>
			<tui-list-cell @click="$tools.uniApp.navigateTo('/pages/help/zhifu?is5=true')" class="tui-list">
				<tui-icon name="wealth-fill" color="#ff7900"></tui-icon>
				<view class="tui-list-cell-name">39购买80积分</view>
			</tui-list-cell>
			
		<!-- 	<tui-list-cell class="tui-list" v-if="$xinli.user.isType(1)">
				<view class="tui-list-cell-name">复制以下内容,供他人浏览器打开注册</view>
			</tui-list-cell>
			<tui-list-cell class="tui-list" v-if="$xinli.user.isType(1)">
				<textarea type="tel" class="uni-input" name="mobile" v-model="invitationcodeUrl" placeholder="推广链接" />
			</tui-list-cell> -->
			<tui-list-cell v-if="$xinli.user.isType(2)" @click="$tools.uniApp.navigateTo('edit')" class="tui-list">
				<tui-icon name="wealth-fill" color="#fcd6d2"></tui-icon>
				<view class="tui-list-cell-name">服务账单</view>
			</tui-list-cell>
			<tui-list-cell v-if="$xinli.user.isType(3)" @click="$tools.uniApp.navigateTo('addJiFen')" class="tui-list">
				<tui-icon name="wealth-fill" color="#fcd6d2"></tui-icon>
				<view class="tui-list-cell-name">修改用户积分</view>
			</tui-list-cell>
			<!-- 
			取出
			<tui-list-cell  @click="createGroup" class="tui-list">
				<tui-icon name="wealth-fill" color="#fcd6d2"></tui-icon>
				<view class="tui-list-cell-name">createGroup</view>
			</tui-list-cell>
			<tui-list-cell  @click="getGroupList" class="tui-list">
				<tui-icon name="wealth-fill" color="#fcd6d2"></tui-icon>
				<view class="tui-list-cell-name">getGroupList</view>
			</tui-list-cell> -->
			<!-- 
			审核不通过。
			<tui-list-cell @click="detail" class="tui-list">
				<tui-icon name="alipay" color="#fcd6d2"></tui-icon>
				<view class="tui-list-cell-name">支付H5测试</view>
				<tui-tag size="small" type="light-orange" shape="circle" class="tui-right">请不要轻易点击</tui-tag>
			</tui-list-cell> -->
			<tui-list-cell @click="outLoginBtn" class="tui-list">
				<tui-icon name="setup-fill" color="#fcd6d2"></tui-icon>
				<view class="tui-list-cell-name">退出登录</view>
			</tui-list-cell>
		</tui-list-view>
	</view>
</template>

<script>
	import tuiListView from "@/components/tui/list-view"
	import tuiListCell from "@/components/tui/list-cell"
	import tuiIcon from "@/components/tui/icon"
	import tuiTag from "@/components/tui/tag"
	import tuiBadge from "@/components/tui/badge"
	export default {
		components: {
			tuiListView,
			tuiListCell,
			tuiIcon,
			tuiTag,
			tuiBadge
		},
		data() {
			return {
				invitationcodeUrl : ''
			}
		},
		onLoad(){
			this.invitationcodeUrl = this.$tools.share.getUrl();
			// #ifndef H5
			uni.showShareMenu({
				showShareItems : ['qq', 'qzone', 'wechatFriends', 'wechatMoment']	
			});
			// #endif
		},
		methods: {
			joinGroup(){
				
			},
			getGroupList(){
				// 该接口默认只会拉取这些资料：群类型、群名称、群头像、最后一条消息的时间。
				let promise = this.tim.getGroupList();
				promise.then(function(imResponse) {
				  console.log(imResponse.data.groupList); // 群组列表
				}).catch(function(imError) {
				  console.warn('getGroupList error:', imError); // 获取群组列表失败的相关信息
				});
			},
			createGroup(){
				console.log('onLoad',this.tim);
				// 创建聊天室
				let promise = this.tim.createGroup({
				  type: this.$TIM.TYPES.GRP_CHATROOM,
				  name: 'WebSDK',
				  memberList: [{userID: 'user1'}, {userID: 'user2'}] // 如果填写了 memberList，则必须填写 userID
				});
				promise.then(function(imResponse) { // 创建成功
				  console.log('createGroup ok:',imResponse.data.group); // 创建的群的资料
				}).catch(function(imError) {
				  console.warn('createGroup error:', imError); // 创建群组失败的相关信息
				});
			},
			tuiguang: function() {
				this.$tools.share.shareUrl();
			},
			bianjiXinxi: function() {
				uni.navigateTo({
					url: 'edit'
				})
			},
			gerenXinxi: function() {
				uni.navigateTo({
					url: './userInfo'
				})
			},
			detail: function() {
				uni.navigateTo({
					url: './zhifu'
				})
			},
			outLoginBtn(){
				uni.clearStorage('userInfo');
				uni.reLaunch({
					url: '/pages/login/login'
				})
				let promise = this.tim.logout();
				promise.then(res=> {
					this.$store.commit('reset')
				}).catch(err=> {
				   console.log('退出失败')
				});
			},
		}
	}
</script>

<style lang="scss">
	.container {
		padding-bottom: env(safe-area-inset-bottom);
	}


	.tui-list-cell-name {
		padding-left: 20upx;
		vertical-align: middle;
		line-height: 30upx;
	}

	.tui-list::after {
		left: 94upx !important
	}

	.tui-right {
		margin-left: auto;
		margin-right: 34upx;
		font-size: 26upx;
		line-height: 1;
		color: #999;
	}

	.logo {
		height: 40upx;
		width: 40upx;
	}

	.tui-flex {
		display: flex;
		align-items: center;
	}

	.tui-msg-box {
		display: flex;
		align-items: center;
	}

	.tui-msg-pic {
		width: 100upx;
		height: 100upx;
		border-radius: 50%;
		display: block;
		margin-right: 24upx;
	}

	.tui-msg-item {
		max-width: 500upx;
		min-height: 80upx;
		overflow: hidden;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}

	.tui-msg-name {
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		font-size: 34upx;
		line-height: 1;
		color: #262b3a;
	}

	.tui-msg-content {
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		font-size: 26upx;
		line-height: 1;
		color: #9397a4;
	}

	.tui-msg-right {
		max-width: 120upx;
		height: 88upx;
		margin-left: auto;
		text-align: right;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		align-items: flex-end;
	}

	.tui-msg-right.tui-right-dot {
		height: 76upx;
		padding-bottom: 10upx;

	}

	.tui-msg-time {
		width: 100%;
		font-size: 24upx;
		line-height: 24upx;
		color: #9397a4;
	}

	.tui-badge {
		width: auto
	}

	.tui-msg::after {
		left: 154upx !important
	}
</style>
